
package br.ufu.lsi.database.collector.old;

import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;

import twitter4j.Twitter;
import br.ufu.lsi.database.factory.TwitterBuilder;

public class OldCollector {

    private TwitterBuilder builder = new TwitterBuilder();
    
    private static final Long FABS177_ID = 991826522L;
    private static final Long ANGELICA_ID = 46277588L;

    //private static final Long SPORTV_ID = 12652472L;
    private static final Long FOXSPORTS_ID = 394471665L;
    private static final Long CNNSPORTS_ID = 34992644L;
    private static final Long NYTSPORTS_ID = 1766701L;

    public static void main( String... args ) throws Exception {

        OldCollector oldCollector = new OldCollector();

        oldCollector.followersList();
        
        oldCollector.timeline();
        
    }
    
    

    public void followersList() throws Exception {

        ExecutorService executor = Executors.newFixedThreadPool( 5 );

        Twitter twitter1 = this.builder.getTwitter();
        Runnable worker1 = new FollowersListThread( twitter1, NYTSPORTS_ID );

        /*Twitter twitter2 = this.builder.getTwitter();
        Runnable worker2 = new FollowersListThread( twitter2, SPORTV_ID );
        
        Twitter twitter3 = this.builder.getTwitter();
        Runnable worker3 = new FollowersListThread( twitter3, CNNSPORTS_ID );*/

        executor.execute( worker1 );
        /*executor.execute( worker2 );
        executor.execute( worker3 );*/
    }

    
    public void timeline() throws Exception {
        
        ExecutorService executor = Executors.newFixedThreadPool( 6 );
        
        Twitter twitter1 = this.builder.getTwitter();
        Runnable worker1 = new TimelineThread( twitter1, CNNSPORTS_ID, "-1" );
        
        
        /*Twitter twitter2 = this.builder.getTwitter();
        Runnable worker2 = new TimelineThread( twitter2, CNNSPORTS_ID, "-2");
        */
        Twitter twitter4 = this.builder.getTwitter();
        Runnable worker4 = new TimelineThread( twitter4, CNNSPORTS_ID, "-4" );
        
        Twitter twitter6 = this.builder.getTwitter();
        Runnable worker6 = new TimelineThread( twitter6, CNNSPORTS_ID, "-6" );
        
        Twitter twitter7 = this.builder.getTwitter();
        Runnable worker7 = new TimelineThread( twitter7, CNNSPORTS_ID, "-7" );
        
        Twitter twitter8 = this.builder.getTwitter();
        Runnable worker8 = new TimelineThread( twitter8, CNNSPORTS_ID, "-8" );

        executor.execute( worker1 );
        //executor.execute( worker2 );
        executor.execute( worker4 );
        executor.execute( worker6 );
        executor.execute( worker7 );
        executor.execute( worker8 );
        
    }

}
